#include "service.h"

Any Service::run()
{
    std::string file_path = "";
    while (true)
    {
        RequestMessage reqMsg = msgrout2serviceMQ.pop();
        if("GET" == reqMsg.req->method)
        {
            switch (reqMsg.type)
            {
            case ReqType::STATIC: 
                file_path = rootDir + "/resources" + reqMsg.req->path;
                reqMsg.res->set_file_content(file_path);
                break;
            
            case ReqType::PUBLIC: 
                
                break;

            default:
                break;
            }
        }

        // 通知路由线程该请求处理已完成
        reqMsg.completion_promise->set_value();
    }    
}